//
//  ZZWebViewController.m
//  zhengzai-tv
//
//  Created by SC on 16/6/16.
//  Copyright © 2016年 zhengzai.tv. All rights reserved.
//

#import "ZZWebViewController.h"
#import "ZZWebViewModel.h"

@interface ZZWebViewController ()

@property (nonatomic, weak, readwrite) IBOutlet UIWebView *webView;
@property (nonatomic, strong) ZZWebViewModel *viewModel;

@end

@implementation ZZWebViewController

@synthesize viewModel = _viewModel;

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.webView loadRequest:self.viewModel.request];
}

#pragma mark - UIWebViewDelegate
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
    if (navigationType == UIWebViewNavigationTypeOther) {
        if ([request.URL.scheme isEqualToString:@"http"] || [request.URL.scheme isEqualToString:@"https"]) {
            
        }
        return YES;
    } else {
        [[UIApplication sharedApplication] openURL:request.URL];
        return NO;
    }
}

- (void)webViewDidStartLoad:(UIWebView *)webView
{
    
}

- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    
}

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
    
}

@end
